package com.bwie.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import java.util.List;
import java.util.Set;

public class RedisConfig {

    /**
     * 创建jedis连接池对象
     */
    public static JedisPool jedisPool() {
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        poolConfig.setMaxTotal(10);
        poolConfig.setMaxIdle(5);
        poolConfig.setMinIdle(2);
        return new JedisPool(poolConfig, "127.0.0.1", 6379, 3000, "123456");
    }

    /**
     * 关闭jedis和jedis连接池的方法
     */
    public static void close(Jedis jedis, JedisPool jedisPool) {
        if (null != jedis) {
            jedis.close();
        }
        if (null != jedisPool) {
            jedisPool.close();
        }
    }

 
}